package ay.shadow.seckill.controller;

import ay.shadow.seckill.entity.vo.LoginVo;
import ay.shadow.seckill.entity.vo.RespBean;
import ay.shadow.seckill.service.IUserService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 暗影
 * @since 2025-02-27
 */
@Controller
@RequestMapping("/login")
public class UserController {
    @Resource
    private  IUserService userService;

    @RequestMapping("login")
    public String toLogin(){
        return "login";
    }
    @RequestMapping("doLogin")
    @ResponseBody
    public RespBean doLogin(LoginVo loginVo, HttpServletRequest request, HttpServletResponse response){
        return userService.doLogin(loginVo,request,response);
    }

}

